package com.yjck.fm.selfinfo.dao.impl;

import com.yjck.fm.selfinfo.dao.SelfDAO;
import com.yjck.fm.util.DBUtil;

public class SelfDAOImpl implements SelfDAO{
	private DBUtil dbUtil;	

	public void setDbUtil(DBUtil dbUtil) {
		this.dbUtil = dbUtil;
	}

	public boolean checkPass(String email, String passwd) {
		int flag =0;
		String sql = "select * from user where email = ? and passwd = ?";
		Object[] params = new Object[]{email,passwd};
		flag = dbUtil.getCount(sql,params);
		if(flag == 1){
			return true;
		}else{
			return false;
		}
		
	}

	public boolean modifyPass(String email, String password) {			
			String sql = "update user set passwd = ? where email = ?";
			Object[] params = new Object[]{password,email};
			int flag = dbUtil.execUpdate(sql, params);
			if(flag == 1){
				return true;
			}else{
				return false;			
			}
		}

}
